
/*
*****Hamradio Deluxe Bandcode by OZ2JFV v. 1.0 by OZ2JFV*****
Copyright (c) 2013 Jens Vestergaard.  All rights reserved.
This code is released under the MIT license
http://opensource.org/licenses/MIT



The code determines operating frequency using a serial connection to rig control software.
It works with Ham Radio Deluxe (http://http://www.ham-radio-deluxe.com) using the "3rd party serial port." 
See: http://www.arduino.cc/ for hardware information.



 */

 

 
			//declare variables

int ledpin=13;    				//status led
int bit0 = 45;   				//Bit 0 to PLC
int bit1 = 46;   				//Bit 1 to PLC
int bit2 = 47;   				//Bit 2 to PLC
int bit3 = 48;   				//Bit 3 to PLC
int bit4 = 49;   				//Bit 4 to PLC
int bit5 = 50;   				//Bit 5 to PLC
int bit6 = 51;   				//Bit 6 to PLC
int bit7 = 52;   				//Bit 7 to PLC
int currband=255;  				//variable to hold the current band
int lastband=255; 				//we'll only change things when bands change
float kHz = 0;     				//frequency in kHz 
int kHint =0; 
char buffer[15]={0}; 			//serial receive buffer, one more space for null char (IMPORTANT!!!)
char freqstr[12]={0}; 			// 11 digit + null
long freqint = 0;     			//long integer frequency in Hertz derived from char string freqstr
int parval = 0; 				//array to write to parallel port, 0-255




void setup() {                
  Serial.begin(57600);    		//57600 for HRD.  
  UCSR0C = UCSR0C | B00001000;	//sets 2 stop bits  (? maybe matters, maybe doesn't)

			//initialize I/O pins
 pinMode(ledpin,OUTPUT); 

pinMode(bit0, OUTPUT);  
pinMode(bit1, OUTPUT);
pinMode(bit2, OUTPUT);
pinMode(bit3, OUTPUT);
pinMode(bit4, OUTPUT);
pinMode(bit5, OUTPUT);
pinMode(bit6, OUTPUT);
pinMode(bit7, OUTPUT);

			//preload the shift register with zeroes (turn all outputs off):
 
 

 
 delay(10);
			//digitalWrite(latch,HIGH);
}

			//********BEGIN void loop()*************
void loop() {

			//********BEGIN "no serial recieved" WHILE LOOP *************
  while (Serial.available()==0) { 				//ask HRD for the frequency
      delay(50);
      Serial.print("FA;");   					// FA; is the command to get VFO A... this seems to be the "active" one

      delay(50);
    
  

delay(5);

			//Serial.println(currband); un-comment to print band over serial  for debugging 
delay(5);
  

			//check to see if new calculated band is the same as the last band, and then decide what to do

			//********BEGIN band change SWITCH/CASE*************
switch(currband-lastband){  
  case 0:   									//if we haven't changed bands, we don't want to update the shift register, but we'll turn on the LED

  digitalWrite(ledpin,HIGH);
  break;
  
  default: 										//if we have changed bands, we update the shift register

  digitalWrite(ledpin,LOW);
  
  
       
			//********BEGIN BIT SWITCH/CASE*************


     switch (currband) {  
       
 case 1 :	
     	    digitalWrite(bit0, HIGH);  
			digitalWrite(bit1, LOW);   
			digitalWrite(bit2, LOW);   
			digitalWrite(bit3, LOW);   
			digitalWrite(bit4, LOW);   
			digitalWrite(bit5, LOW);   
			digitalWrite(bit6, LOW);   
			digitalWrite(bit7, LOW);   
       break;	
	
 case 2 :	
     	    digitalWrite(bit0, LOW);  
			digitalWrite(bit1, HIGH);   
			digitalWrite(bit2, LOW);   
			digitalWrite(bit3, LOW);   
			digitalWrite(bit4, LOW);   
			digitalWrite(bit5, LOW);   
			digitalWrite(bit6, LOW);   
			digitalWrite(bit7, LOW);   
       break;	
	
 case 3 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	

 case 4 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 5 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 6 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 7 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 8 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 9 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 10 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 11 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 12 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 13 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 14 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 15 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 16 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 17 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 18 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 19 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);
       break;	
	
 case 20 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 21 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 22 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 23 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 24 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 25 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 26 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 27 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 28 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 29 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 30 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 31 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 32 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 33 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 34 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 35 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 36 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 37 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 38 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 39 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 40 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 41 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 42 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 43 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 44 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 45 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 46 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 47 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 48 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 49 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 50 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 51 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 52 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 53 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 54 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 55 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 56 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 57 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 58 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 59 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 60 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);      
       break;	
 case 61 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 62 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 63 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 64 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 65 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 66 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 67 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 68 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 69 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 70 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 71 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 72 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 73 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 74 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 75 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 76 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 77 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 78 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 79 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 80 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 81 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 82 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 83 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 84 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 85 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 86 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 87 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 88 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 89 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 90 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 91 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 92 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 93 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 94 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 95 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 96 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 97 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 98 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 99 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 100 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 101 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 102 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 103 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 104 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 105 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 106 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 107 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 108 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 109 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 110 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 111 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 112 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 113 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 114 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 115 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 116 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 117 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 118 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 119 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 120 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 121 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 122 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 123 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
       
 case 124 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 125 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 126 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
 case 127 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 128 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, LOW);   
       break;	
	
 case 129 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 130 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 131 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 132 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 133 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 134 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 135 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 136 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 137 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 138 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 139 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 140 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 141 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 142 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 143 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 144 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 145 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 146 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 147 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 148 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 149 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 150 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 151 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 152 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 153 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 154 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 155 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 156 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 157 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 158 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 159 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 160 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 161 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 162 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 163 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 164 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 165 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 166 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 167 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 168 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 169 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 170 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 171 :	
		   digitalWrite(bit0, HIGH);  
		   digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 172 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 173 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 174 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 175 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 176 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 177 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 178 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 179 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 180 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
case 181 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;
 case 182 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;
 case 183 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;
 case 184 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;
 case 185 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	   
 case 186 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;
 case 187 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;
 case 188 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;
 case 189 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;
	   
 case 190 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 191 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, LOW);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 192 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 193 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 194 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 195 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 196 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 197 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 198 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 199 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	//
 case 200 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 201 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 202 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 203 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 204 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 205 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 206 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 207 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 208 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 209 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 210 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 211 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 212 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 213 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 214 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 215 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 216 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 217 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 218 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 219 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 220 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 221 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 222 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 223 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, LOW);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 224 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 225 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 226 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 227 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
case 228 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;		
 case 229 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 230 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 231 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 332 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 233 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 234 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 235 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 236 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 237 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 338 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 239 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, LOW);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 240 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 241 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 242 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 243 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 244 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 245 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 246 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 247 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, LOW);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 248 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 249 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 250 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 251 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, LOW);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 252 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
	
 case 253 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, LOW);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 254 :	
     	   digitalWrite(bit0, LOW);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
 case 255 :	
     	   digitalWrite(bit0, HIGH);  
	       digitalWrite(bit1, HIGH);   
	       digitalWrite(bit2, HIGH);   
	       digitalWrite(bit3, HIGH);   
	       digitalWrite(bit4, HIGH);   
	       digitalWrite(bit5, HIGH);   
	       digitalWrite(bit6, HIGH);   
	       digitalWrite(bit7, HIGH);   
       break;	
   
       
       
       }
			//********END of currband SWITCH/CASE here *************
    }

    
     delay(50);
    
   }
			//********END "no serial recieved" WHILE LOOP here *************

			//****** BEGIN "do nothing while HRD is transmitting back data" ***********
 while (Serial.available()>0 && Serial.available()<14){
 
}
			//****** END "do nothing while HRD is transmitting back data" **************

			//****** BEGIN serial string parser **************
			//once 14 characters have come in ( FA###########; )  read them in to a single array.
  if (Serial.available()>=14) {  for (int x=0; x<14; x++) {
  buffer[x] = Serial.read();
  }
    delay(5);
			//parse the 11 frequency characters and store those in "freqstr"
  for (int i=2; i<13; i++){
    freqstr[i-2]=buffer[i];}
    Serial.flush();
     freqint=atol(freqstr);  				//change freqstr from a char array to a long integer
    
    kHz = freqint/1000;  					//the test conditions in bandval() are easier to read if frequency is in kHz
   
    currband = bandval(kHz);  				//figure out the band from the frequency
     
     
  }
			//****** END serial string parser **************
     
 
    
    
     
    
     delay(50);

 }
			//********END loop()****************

			//**************BEGIN FUNCTION DEFINITIONS BELOW***************


   
int bandval(float input_freq){ 
  int band=255; //return 255 if no bands match
   if (input_freq>=	1800	&& input_freq<=		1850	){band=1;}
 if (input_freq>=	1850	&& input_freq<=		1900	){band=2;}
 if (input_freq>=	1900	&& input_freq<=		1950	){band=3;}
 if (input_freq>=	1950	&& input_freq<=		2000	){band=4;}
 if (input_freq>=	3000	&& input_freq<=		3500	){band=5;}
 if (input_freq>=	3500	&& input_freq<=		3550	){band=6;}
 if (input_freq>=	3550	&& input_freq<=		3600	){band=7;}
 if (input_freq>=	3600	&& input_freq<=		3650	){band=8;}
 if (input_freq>=	3650	&& input_freq<=		3700	){band=9;}
 if (input_freq>=	3700	&& input_freq<=		3750	){band=10;}
 if (input_freq>=	3750	&& input_freq<=		3800	){band=11;}
 if (input_freq>=	3800	&& input_freq<=		4000	){band=12;}
 if (input_freq>=	5000	&& input_freq<=		5200	){band=13;}
 if (input_freq>=	5200	&& input_freq<=		5250	){band=14;}
 if (input_freq>=	5250	&& input_freq<=		5300	){band=15;}
 if (input_freq>=	5300	&& input_freq<=		5350	){band=16;}
 if (input_freq>=	5350	&& input_freq<=		5400	){band=17;}
 if (input_freq>=	5400	&& input_freq<=		5450	){band=18;}
 if (input_freq>=	5450	&& input_freq<=		5500	){band=19;}
 if (input_freq>=	6500	&& input_freq<=		7000	){band=20;}
 if (input_freq>=	7000	&& input_freq<=		7050	){band=21;}
 if (input_freq>=	7050	&& input_freq<=		7100	){band=22;}
 if (input_freq>=	7100	&& input_freq<=		7150	){band=23;}
 if (input_freq>=	7150	&& input_freq<=		7200	){band=24;}
 if (input_freq>=	7200	&& input_freq<=		7300	){band=25;}
 if (input_freq>=	10000	&& input_freq<=		10100	){band=26;}
 if (input_freq>=	10100	&& input_freq<=		10150	){band=27;}
 if (input_freq>=	10150	&& input_freq<=		10200	){band=28;}
 if (input_freq>=	14000	&& input_freq<=		14000	){band=29;}
 if (input_freq>=	14000	&& input_freq<=		14050	){band=30;}
 if (input_freq>=	14050	&& input_freq<=		14100	){band=31;}
 if (input_freq>=	14100	&& input_freq<=		14150	){band=32;}
 if (input_freq>=	14150	&& input_freq<=		14200	){band=33;}
 if (input_freq>=	14200	&& input_freq<=		14250	){band=34;}
 if (input_freq>=	14250	&& input_freq<=		14300	){band=35;}
 if (input_freq>=	14300	&& input_freq<=		14350	){band=36;}
 if (input_freq>=	18000	&& input_freq<=		18050	){band=37;}
 if (input_freq>=	18050	&& input_freq<=		18100	){band=38;}
 if (input_freq>=	18100	&& input_freq<=		18150	){band=39;}
 if (input_freq>=	18150	&& input_freq<=		18160	){band=40;}
 if (input_freq>=	20950	&& input_freq<=		21000	){band=41;}
 if (input_freq>=	21000	&& input_freq<=		21050	){band=42;}
 if (input_freq>=	21050	&& input_freq<=		21100	){band=43;}
 if (input_freq>=	21100	&& input_freq<=		21150	){band=44;}
 if (input_freq>=	21150	&& input_freq<=		21200	){band=45;}
 if (input_freq>=	21200	&& input_freq<=		21250	){band=46;}
 if (input_freq>=	21250	&& input_freq<=		21300	){band=47;}
 if (input_freq>=	21300	&& input_freq<=		21350	){band=48;}
 if (input_freq>=	21350	&& input_freq<=		21400	){band=49;}
 if (input_freq>=	21400	&& input_freq<=		21450	){band=50;}
 if (input_freq>=	21450	&& input_freq<=		21500	){band=51;}
 if (input_freq>=	24800	&& input_freq<=		24800	){band=52;}
 if (input_freq>=	24800	&& input_freq<=		24850	){band=53;}
 if (input_freq>=	24850	&& input_freq<=		24900	){band=54;}
 if (input_freq>=	24900	&& input_freq<=		24950	){band=55;}
 if (input_freq>=	24950	&& input_freq<=		25000	){band=56;}
 if (input_freq>=	27950	&& input_freq<=		28000	){band=57;}
 if (input_freq>=	28000	&& input_freq<=		28050	){band=58;}
 if (input_freq>=	28050	&& input_freq<=		28100	){band=59;}
 if (input_freq>=	28100	&& input_freq<=		28150	){band=60;}
 if (input_freq>=	28150	&& input_freq<=		28200	){band=61;}
 if (input_freq>=	28200	&& input_freq<=		28250	){band=62;}
 if (input_freq>=	28250	&& input_freq<=		28300	){band=63;}
 if (input_freq>=	28300	&& input_freq<=		28350	){band=64;}
 if (input_freq>=	28350	&& input_freq<=		28400	){band=65;}
 if (input_freq>=	28400	&& input_freq<=		28450	){band=66;}
 if (input_freq>=	28450	&& input_freq<=		28500	){band=67;}
 if (input_freq>=	28500	&& input_freq<=		28550	){band=68;}
 if (input_freq>=	28550	&& input_freq<=		28600	){band=69;}
 if (input_freq>=	28600	&& input_freq<=		28650	){band=70;}
 if (input_freq>=	28650	&& input_freq<=		28700	){band=71;}
 if (input_freq>=	28700	&& input_freq<=		28750	){band=72;}
 if (input_freq>=	28750	&& input_freq<=		28800	){band=73;}
 if (input_freq>=	28800	&& input_freq<=		28850	){band=74;}
 if (input_freq>=	28850	&& input_freq<=		28900	){band=75;}
 if (input_freq>=	28900	&& input_freq<=		28950	){band=76;}
 if (input_freq>=	28950	&& input_freq<=		29000	){band=77;}
 if (input_freq>=	29000	&& input_freq<=		29050	){band=78;}
 if (input_freq>=	29050	&& input_freq<=		29100	){band=79;}
 if (input_freq>=	29100	&& input_freq<=		29150	){band=80;}
 if (input_freq>=	29150	&& input_freq<=		29200	){band=81;}
 if (input_freq>=	29200	&& input_freq<=		29250	){band=82;}
 if (input_freq>=	29250	&& input_freq<=		29300	){band=83;}
 if (input_freq>=	29300	&& input_freq<=		29350	){band=84;}
 if (input_freq>=	29350	&& input_freq<=		29400	){band=85;}
 if (input_freq>=	29400	&& input_freq<=		29450	){band=86;}
 if (input_freq>=	29450	&& input_freq<=		29500	){band=87;}
 if (input_freq>=	29500	&& input_freq<=		29550	){band=88;}
 if (input_freq>=	29550	&& input_freq<=		29600	){band=89;}
 if (input_freq>=	29600	&& input_freq<=		29650	){band=90;}
 if (input_freq>=	29650	&& input_freq<=		29700	){band=91;}
 if (input_freq>=	29700	&& input_freq<=		29750	){band=92;}
 if (input_freq>=	50000	&& input_freq<=		50000	){band=93;}
 if (input_freq>=	50000	&& input_freq<=		50050	){band=94;}
 if (input_freq>=	50050	&& input_freq<=		50100	){band=95;}
 if (input_freq>=	50100	&& input_freq<=		50150	){band=96;}
 if (input_freq>=	50150	&& input_freq<=		50200	){band=97;}
 if (input_freq>=	50200	&& input_freq<=		50250	){band=98;}
 if (input_freq>=	50250	&& input_freq<=		50300	){band=99;}
 if (input_freq>=	50300	&& input_freq<=		50350	){band=100;}
 if (input_freq>=	50350	&& input_freq<=		50400	){band=101;}
 if (input_freq>=	50400	&& input_freq<=		50450	){band=102;}
 if (input_freq>=	50450	&& input_freq<=		50500	){band=103;}
 if (input_freq>=	50500	&& input_freq<=		50550	){band=104;}
 if (input_freq>=	50550	&& input_freq<=		50600	){band=105;}
 if (input_freq>=	50600	&& input_freq<=		50650	){band=106;}
 if (input_freq>=	50650	&& input_freq<=		50700	){band=107;}
 if (input_freq>=	50700	&& input_freq<=		50750	){band=108;}
 if (input_freq>=	50750	&& input_freq<=		50800	){band=109;}
 if (input_freq>=	50800	&& input_freq<=		50850	){band=110;}
 if (input_freq>=	50850	&& input_freq<=		50900	){band=111;}
 if (input_freq>=	50900	&& input_freq<=		50950	){band=112;}
 if (input_freq>=	50950	&& input_freq<=		51000	){band=113;}
 if (input_freq>=	51000	&& input_freq<=		51050	){band=114;}
 if (input_freq>=	51050	&& input_freq<=		51100	){band=115;}
 if (input_freq>=	51100	&& input_freq<=		51150	){band=116;}
 if (input_freq>=	51150	&& input_freq<=		51200	){band=117;}
 if (input_freq>=	51200	&& input_freq<=		51250	){band=118;}
 if (input_freq>=	51250	&& input_freq<=		51300	){band=119;}
 if (input_freq>=	51300	&& input_freq<=		51350	){band=120;}
 if (input_freq>=	51350	&& input_freq<=		51400	){band=121;}
 if (input_freq>=	51400	&& input_freq<=		51450	){band=122;}
 if (input_freq>=	51450	&& input_freq<=		51500	){band=123;}
 if (input_freq>=	51500	&& input_freq<=		51550	){band=124;}
 if (input_freq>=	51550	&& input_freq<=		51600	){band=125;}
 if (input_freq>=	51600	&& input_freq<=		51650	){band=126;}
 if (input_freq>=	51650	&& input_freq<=		51700	){band=127;}
 if (input_freq>=	51700	&& input_freq<=		51750	){band=128;}
 if (input_freq>=	51750	&& input_freq<=		51800	){band=129;}
 if (input_freq>=	51800	&& input_freq<=		51850	){band=130;}
 if (input_freq>=	51850	&& input_freq<=		51900	){band=131;}
 if (input_freq>=	51900	&& input_freq<=		51950	){band=132;}
 if (input_freq>=	51950	&& input_freq<=		52000	){band=133;}
 if (input_freq>=	70000	&& input_freq<=		70000	){band=134;}
 if (input_freq>=	70000	&& input_freq<=		70050	){band=135;}
 if (input_freq>=	70050	&& input_freq<=		70100	){band=136;}
 if (input_freq>=	70100	&& input_freq<=		70150	){band=137;}
 if (input_freq>=	70150	&& input_freq<=		70200	){band=138;}
 if (input_freq>=	70200	&& input_freq<=		70250	){band=139;}
 if (input_freq>=	70250	&& input_freq<=		70300	){band=140;}
 if (input_freq>=	70300	&& input_freq<=		70350	){band=141;}
 if (input_freq>=	70350	&& input_freq<=		70400	){band=142;}
 if (input_freq>=	70400	&& input_freq<=		70450	){band=143;}
 if (input_freq>=	70450	&& input_freq<=		70450	){band=144;}
 if (input_freq>=	70450	&& input_freq<=		70450	){band=145;}
 if (input_freq>=	144000	&& input_freq<=		144100	){band=146;}
 if (input_freq>=	144100	&& input_freq<=		144200	){band=147;}
 if (input_freq>=	144200	&& input_freq<=		144300	){band=148;}
 if (input_freq>=	144300	&& input_freq<=		144400	){band=149;}
 if (input_freq>=	144400	&& input_freq<=		144500	){band=150;}
 if (input_freq>=	144500	&& input_freq<=		144600	){band=151;}
 if (input_freq>=	144600	&& input_freq<=		144700	){band=152;}
 if (input_freq>=	144700	&& input_freq<=		144800	){band=153;}
 if (input_freq>=	144800	&& input_freq<=		144900	){band=154;}
 if (input_freq>=	144900	&& input_freq<=		145000	){band=155;}
 if (input_freq>=	145000	&& input_freq<=		145100	){band=156;}
 if (input_freq>=	145100	&& input_freq<=		145200	){band=157;}
 if (input_freq>=	145200	&& input_freq<=		145300	){band=158;}
 if (input_freq>=	145300	&& input_freq<=		145400	){band=159;}
 if (input_freq>=	145400	&& input_freq<=		145500	){band=160;}
 if (input_freq>=	145500	&& input_freq<=		145600	){band=161;}
 if (input_freq>=	145600	&& input_freq<=		145700	){band=162;}
 if (input_freq>=	145700	&& input_freq<=		145800	){band=163;}
 if (input_freq>=	145800	&& input_freq<=		145900	){band=164;}
 if (input_freq>=	145900	&& input_freq<=		146000	){band=165;}
 if (input_freq>=	431900	&& input_freq<=		432000	){band=166;}
 if (input_freq>=	432000	&& input_freq<=		432200	){band=167;}
 if (input_freq>=	432200	&& input_freq<=		432400	){band=168;}
 if (input_freq>=	432400	&& input_freq<=		432600	){band=169;}
 if (input_freq>=	432600	&& input_freq<=		432800	){band=170;}
 if (input_freq>=	432800	&& input_freq<=		433000	){band=171;}
 if (input_freq>=	433000	&& input_freq<=		433200	){band=172;}
 if (input_freq>=	433200	&& input_freq<=		433400	){band=173;}
 if (input_freq>=	433400	&& input_freq<=		433600	){band=174;}
 if (input_freq>=	433600	&& input_freq<=		433800	){band=175;}
 if (input_freq>=	433800	&& input_freq<=		434000	){band=176;}
 if (input_freq>=	434000	&& input_freq<=		434200	){band=177;}
 if (input_freq>=	434200	&& input_freq<=		434400	){band=178;}
 if (input_freq>=	434400	&& input_freq<=		434600	){band=179;}
 if (input_freq>=	434600	&& input_freq<=		434800	){band=180;}
 if (input_freq>=	434800	&& input_freq<=		435000	){band=181;}
 if (input_freq>=	435000	&& input_freq<=		435200	){band=182;}
 if (input_freq>=	435200	&& input_freq<=		435400	){band=183;}
 if (input_freq>=	435400	&& input_freq<=		435600	){band=184;}
 if (input_freq>=	435600	&& input_freq<=		435800	){band=185;}
 if (input_freq>=	435800	&& input_freq<=		436000	){band=186;}
 if (input_freq>=	436000	&& input_freq<=		436200	){band=187;}
 if (input_freq>=	436200	&& input_freq<=		436400	){band=188;}
 if (input_freq>=	436400	&& input_freq<=		436600	){band=189;}
 if (input_freq>=	436600	&& input_freq<=		436800	){band=190;}
 if (input_freq>=	436800	&& input_freq<=		437000	){band=191;}
 if (input_freq>=	437000	&& input_freq<=		437200	){band=192;}
 if (input_freq>=	437200	&& input_freq<=		437400	){band=193;}
 if (input_freq>=	437400	&& input_freq<=		437600	){band=194;}
 if (input_freq>=	437600	&& input_freq<=		437800	){band=195;}
 if (input_freq>=	437800	&& input_freq<=		438000	){band=196;}
 if (input_freq>=	1239900	&& input_freq<=		1240000	){band=197;}
 if (input_freq>=	1240000	&& input_freq<=		1243000	){band=198;}
 if (input_freq>=	1243000	&& input_freq<=		1246000	){band=199;}
 if (input_freq>=	1246000	&& input_freq<=		1247000	){band=200;}
 if (input_freq>=	1247000	&& input_freq<=		1250000	){band=201;}
 if (input_freq>=	1250000	&& input_freq<=		1253000	){band=202;}
 if (input_freq>=	1253000	&& input_freq<=		1256000	){band=203;}
 if (input_freq>=	1256000	&& input_freq<=		1259000	){band=204;}
 if (input_freq>=	1259000	&& input_freq<=		1262000	){band=205;}
 if (input_freq>=	1262000	&& input_freq<=		1265000	){band=206;}
 if (input_freq>=	1265000	&& input_freq<=		1268000	){band=207;}
 if (input_freq>=	1268000	&& input_freq<=		1271000	){band=208;}
 if (input_freq>=	1271000	&& input_freq<=		1274000	){band=209;}
 if (input_freq>=	1274000	&& input_freq<=		1277000	){band=210;}
 if (input_freq>=	1277000	&& input_freq<=		1280000	){band=211;}
 if (input_freq>=	1280000	&& input_freq<=		1283000	){band=212;}
 if (input_freq>=	1283000	&& input_freq<=		1286000	){band=213;}
 if (input_freq>=	1286000	&& input_freq<=		1289000	){band=214;}
 if (input_freq>=	1289000	&& input_freq<=		1292000	){band=215;}
 if (input_freq>=	1292000	&& input_freq<=		1295000	){band=216;}
 if (input_freq>=	1295000	&& input_freq<=		1298000	){band=217;}
 if (input_freq>=	1298001	&& input_freq<=		1298002	){band=218;}	
 if (input_freq>=	1298003	&& input_freq<=		1298004	){band=219;}	
 if (input_freq>=	1298005	&& input_freq<=		1298006	){band=220;}	
 if (input_freq>=	1298007	&& input_freq<=		1298008	){band=221;}	
 if (input_freq>=	1298009	&& input_freq<=		1298010	){band=222;}	
 if (input_freq>=	1298011	&& input_freq<=		1298012	){band=223;}	
 if (input_freq>=	1298013	&& input_freq<=		1298014	){band=224;}	
 if (input_freq>=	1298015	&& input_freq<=		1298016	){band=225;}	
 if (input_freq>=	1298017	&& input_freq<=		1298018	){band=226;}	
 if (input_freq>=	1298019	&& input_freq<=		1298020	){band=227;}	
 if (input_freq>=	1298021	&& input_freq<=		1298022	){band=228;}	
 if (input_freq>=	1298023	&& input_freq<=		1298024	){band=229;}	
 if (input_freq>=	1298025	&& input_freq<=		1298026	){band=230;}	
 if (input_freq>=	1298027	&& input_freq<=		1298028	){band=231;}	
 if (input_freq>=	1298029	&& input_freq<=		1298030	){band=232;}	
 if (input_freq>=	1298031	&& input_freq<=		1298032	){band=233;}	
 if (input_freq>=	1298033	&& input_freq<=		1298034	){band=234;}	
 if (input_freq>=	1298035	&& input_freq<=		1298036	){band=235;}	
 if (input_freq>=	1298037	&& input_freq<=		1298038	){band=236;}	
 if (input_freq>=	1298039	&& input_freq<=		1298040	){band=237;}	
 if (input_freq>=	1298041	&& input_freq<=		1298042	){band=238;}	
 if (input_freq>=	1298043	&& input_freq<=		1298044	){band=239;}	
 if (input_freq>=	1298045	&& input_freq<=		1298046	){band=240;}	
 if (input_freq>=	1298047	&& input_freq<=		1298048	){band=241;}	
 if (input_freq>=	1298049	&& input_freq<=		1298050	){band=242;}	
 if (input_freq>=	1298051	&& input_freq<=		1298052	){band=243;}	
 if (input_freq>=	1298053	&& input_freq<=		1298054	){band=244;}	
 if (input_freq>=	1298055	&& input_freq<=		1298056	){band=245;}	
 if (input_freq>=	1298057	&& input_freq<=		1298058	){band=246;}	
 if (input_freq>=	1298059	&& input_freq<=		1298060	){band=247;}	
 if (input_freq>=	1298061	&& input_freq<=		1298062	){band=248;}	
 if (input_freq>=	1298063	&& input_freq<=		1298064	){band=249;}	
 if (input_freq>=	1298065	&& input_freq<=		1298066	){band=250;}	
 if (input_freq>=	1298067	&& input_freq<=		1298068	){band=251;}	
 if (input_freq>=	1298069	&& input_freq<=		1298070	){band=252;} 	
 if (input_freq>=	1298071	&& input_freq<=		1298072	){band=253;}	
 if (input_freq>=	1298073	&& input_freq<=		1298074	){band=254;}	
 if (input_freq>=	1298075	&& input_freq<=		1298076	){band=255;}	
 
 
						


  return band;

}

		//writereg() loads data onto the shift register when the band changes.
void writereg(int dpin, int clpin, int regval) {

delay(5);
shiftOut(dpin,clpin,MSBFIRST,regval);
delay(5);

}
